<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title></title>
    </head>
    <body>
        <div id = "time"></div>
        <script type="text/javascript">
            function getNewTime(){
                var timeDiv = document.getElementById("time");
                var today = new Date();
                var year = today.getFullYear();
                var month = today.getMonth();
                var date1 = today.getDate();
                var day = today.getDay();
                var week = ["星期天","星期一","星期二","星期三","星期四","星期五","星期六"]
                var hours = today.getHours();
                var minutes = today.getMinutes()<10?"0"+today.getMinutes():today.getMinutes();
                var seconds = today.getSeconds()<10?"0"+today.getSeconds():today.getSeconds();
                timeDiv.innerHTML = year+"年"+(month+1)+"月"+date1+"日"+week[day]+hours+":"+minutes+":"+seconds;
                //使用setTimeout+递归实现时钟计时
                setTimeout(arguments.callee,1000);
            }
            window.onload = function(){
                getNewTime();
            }

</script>
    </body>
</html>